home *** CD-ROM | disk | FTP | other *** search
- ////////////////////////
- // FileEditor
- // by Charles Lloyd
- ////////////////////////
-
-
- /////////////////////////
- // User Settable
- /////////////////////////
- id pathName;
- id rows;
- id cols;
-
- /////////////////////////
- // Internal State
- /////////////////////////
- persistent id fileContentsString;
- persistent id fileNotWritten;
- id borderSize;
-
- - awake
- {
- borderSize = 2;
- rows = 15;
- cols = 65;
- if (!fileContentsString) {
- fileNotWritten = nil;
- }
- }
-
- - setPathName:aPath
- {
- pathName = aPath;
- if (!fileContentsString) {
- fileContentsString = [NSString stringWithContentsOfFile:pathName];
- }
- }
-
- - abbreviatedPathName
- {
- return [pathName lastPathComponent];
- }
-
- - setAbbreviatedPathName:aString
- {
- return nil;
- }
-
- - saveFile
- {
- id aBool;
- id aDataObject = [fileContentsString
- dataUsingEncoding:1];
- aBool = [aDataObject writeToFile:pathName atomically:YES];
- if (aBool == NO) {
- fileNotWritten = YES;
- } else {
- fileNotWritten = NO;
- }
- }
-
- - revertFile
- {
- fileContentsString = [NSString stringWithContentsOfFile:pathName];
- }
-